﻿<%@ Import Namespace="System.Globalization" %>
<%@ Register TagPrefix="ASE" TagName="ListCategoriesControl" Src="/ListCategoriesControl.ascx" %>
<%@ Register TagPrefix="ASE" TagName="ListGroupsControl" Src="/ListGroupsControl.ascx" %>
<%@ Register TagPrefix="ASE" TagName="ListComboControl" Src="/ListComboControl.ascx" %>

<%@ Page Title="" Language="C#" MasterPageFile="~/mainadmin.Master" AutoEventWireup="true"
    CodeBehind="Customers.aspx.cs" Inherits="AsiaSnackExpress.Customers" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
   <script type="text/javascript">
       function ConfirmDeleteCustomer() {
           return confirm("Do you want to delete the customer?");
       }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table cellpadding="0" cellspacing="0" width="100%">
        <tr valign="top">
            <td style="width: 50%">
                <table cellpadding="0" cellspacing="0" width="100%">
                    <tr>
                        <td>
                            <br />
                            &nbsp;&nbsp;
                            <asp:Button ID="btnNewCustomer" runat="server" Text="New Customer" OnClick="btnNewCustomer_Click" />
                            <br />
                            <asp:Label ID="lblUpdateMessage" runat="server" Text="Update successfully." Visible="false"
                                ForeColor="Green"></asp:Label>
                            <br />
                            <asp:Panel ID="panelUpdate" runat="server" Visible="false">
                                <div class="divMealDetailColumn">
                                    <div class="divleft">
                                        <asp:Label ID="order" Font-Bold="true" runat="server" Text='First Name '></asp:Label>
                                    </div>
                                    <div class="divright">
                                        <asp:TextBox ID="txtFirstName" runat="server" Width="100%"></asp:TextBox>
                                        <asp:RequiredFieldValidator ControlToValidate="txtFirstName" ID="RequiredFieldValidator1"
                                            runat="server" ErrorMessage="Please input the Name" Display="Dynamic" ValidationGroup="InputData"></asp:RequiredFieldValidator>
                                    </div>
                                </div>
                                <div class="divMealDetailColumn">
                                    <div class="divleft">
                                        <asp:Label ID="lblLastName" Font-Bold="true" runat="server" Text='Last Name '></asp:Label>
                                    </div>
                                    <div class="divright">
                                        <asp:TextBox ID="txtCustomerId" runat="server" Visible="false"></asp:TextBox>
                                        <asp:TextBox ID="txtLastName" runat="server" Width="100%"></asp:TextBox>
                                    </div>
                                </div>
                                <div class="divMealDetailColumn">
                                    <div class="divleft">
                                        <asp:Label ID="Label2" Font-Bold="true" runat="server" Text='Adress '></asp:Label>
                                    </div>
                                    <div class="divright">
                                        <asp:TextBox ID="txtRoad" runat="server" Width="100%"></asp:TextBox>
                                    </div>
                                </div>
                                <div class="divMealDetailColumn">
                                    <div class="divleft">
                                        <asp:Label ID="Label3" Font-Bold="true" runat="server" Text='ZipCode '></asp:Label>
                                    </div>
                                    <div class="divright">
                                        <asp:TextBox ID="txtZipCode" runat="server" Width="50%"></asp:TextBox>
                                    </div>
                                </div>
                                <div class="divMealDetailColumn">
                                    <div class="divleft">
                                        <asp:Label ID="Label4" Font-Bold="true" runat="server" Text='City '></asp:Label>
                                    </div>
                                    <div class="divright">
                                        <asp:TextBox ID="txtCity" runat="server" Width="50%"></asp:TextBox>
                                    </div>
                                </div>
                                <div class="divMealDetailColumn">
                                    <div class="divleft">
                                        <asp:Label ID="Label5" Font-Bold="true" runat="server" Text='Country '></asp:Label>
                                    </div>
                                    <div class="divright">
                                        <asp:TextBox ID="txtCountry" runat="server" Width="100%"></asp:TextBox>
                                    </div>
                                </div>
                                  <div class="divMealDetailColumn">
                                    <div class="divleft">
                                        <asp:Label ID="Label11" Font-Bold="true" runat="server" Text='Mobi '></asp:Label>
                                    </div>
                                    <div class="divright">
                                        <asp:TextBox ID="txtMobi" runat="server" Width="100%"></asp:TextBox>
                                    </div>
                                </div>
                                <div class="divMealDetailColumn">
                                    <div class="divleft">
                                        <asp:Label ID="Label6" Font-Bold="true" runat="server" Text='Telephone '></asp:Label>
                                    </div>
                                    <div class="divright">
                                        <asp:TextBox ID="txtTelephone" runat="server" Width="100%"></asp:TextBox>
                                    </div>
                                </div>
                                 <div class="divMealDetailColumn">
                                    <div class="divleft">
                                        <asp:Label ID="Label7" Font-Bold="true" runat="server" Text='Home tel '></asp:Label>
                                    </div>
                                    <div class="divright">
                                        <asp:TextBox ID="txtHomeTel" runat="server" Width="100%"></asp:TextBox>
                                    </div>
                                </div>                                    
                                <div class="divMealDetailColumn">
                                    <div class="divleft">
                                        <asp:Label ID="Label8" Font-Bold="true" runat="server" Text='Email '></asp:Label>
                                    </div>
                                    <div class="divright">
                                        <asp:TextBox ID="txtEmail" runat="server" Width="100%"></asp:TextBox>
                                    </div>
                                </div>
                                <div class="divMealDetailColumn">
                                    <div class="divleft">
                                        <asp:Label ID="Label9" Font-Bold="true" runat="server" Text='Birthday '></asp:Label>
                                    </div>
                                    <div class="divright">
                                        <asp:TextBox ID="txtBirthday" runat="server" Width="90%"></asp:TextBox>                                        
                                    </div>
                                </div>
                                <div class="divMealDetailColumn">
                                    <div class="divleft">
                                        <asp:Label ID="Label10" Font-Bold="true" runat="server" Text='Description '></asp:Label>
                                    </div>
                                    <div class="divright">
                                        <asp:TextBox ID="txtDescription" runat="server" Width="100%" TextMode="MultiLine"
                                            Rows="6"></asp:TextBox>
                                    </div>
                                </div>
                                <br />&nbsp;&nbsp;
                                <asp:Button ID="btnAdd" ValidationGroup="InputData" runat="server" Text="  Add" Visible="false"
                                    OnClick="btnAdd_Click" />
                                <asp:Button ID="btnUpdate" ValidationGroup="InputData" runat="server" Text="Update"
                                    OnClick="btnUpdate_Click" />&nbsp;&nbsp;
                                      <asp:Button ID="btnDelete" runat="server" Text="Delete" OnClick="btnDelete_Click"    OnClientClick="return ConfirmDeleteCustomer()"  />&nbsp;&nbsp;
                                <asp:Button ID="btnCancel" runat="server" Text="Cancel" OnClick="btnCancel_Click" />&nbsp;&nbsp;
                            </asp:Panel>
                        </td>
                    </tr>
                </table>
            </td>
            <td>
                <br />
                <asp:TextBox ID="txtSearch" runat="server" Width="300px" Height="30px"></asp:TextBox>
                &nbsp;&nbsp;
                <asp:Button ID="btnSearch" runat="server" Text="Search" OnClick="btnSearch_Click" />
                <br />
                <p>
                    <asp:Literal ID="txtTitle" runat="server" Text="List User"></asp:Literal></p>
                <asp:Literal ID="lblErrorMessage" runat="server" Text="User is not found." Visible="false"></asp:Literal>
                <asp:GridView ID="gridCustomers" runat="server" DataKeyNames="CustomerId" AutoGenerateColumns="False"
                    OnSelectedIndexChanged="CustomersGridView_SelectedIndexChanged" BorderWidth="1px"
                    BackColor="White" CellSpacing="4" CellPadding="4" BorderStyle="None" BorderColor="#3366CC"
                    Width="98%">
                    <FooterStyle ForeColor="#003399" BackColor="#99CCCC"></FooterStyle>
                    <PagerStyle ForeColor="#003399" HorizontalAlign="Left" BackColor="#99CCCC"></PagerStyle>
                    <HeaderStyle ForeColor="#CCCCFF" Font-Bold="True" BackColor="#003399"></HeaderStyle>
                    <Columns>
                        <asp:CommandField ShowSelectButton="True" SelectText="Select"></asp:CommandField>                    
                        <asp:TemplateField HeaderText="Name">
                            <ItemTemplate>
                                <asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"FirstName") + " "  + DataBinder.Eval(Container.DataItem,"LastName")%>'
                                    ID="Label1"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField HeaderText="Telephone" DataField="Telephone"></asp:BoundField>
                        <asp:BoundField HeaderText="Address" DataField="Road"></asp:BoundField>
                    </Columns>
                    <SelectedRowStyle ForeColor="#CCFF99" Font-Bold="True" BackColor="#009999"></SelectedRowStyle>
                    <AlternatingRowStyle BackColor="Aqua" />
                    <RowStyle ForeColor="#003399" BackColor="White"></RowStyle>
                    <SelectedRowStyle ForeColor="#663399" Font-Bold="True" BackColor="#FFCC66"></SelectedRowStyle>
                </asp:GridView>
            </td>
        </tr>
    </table>
</asp:Content>
